Move _gtk_tree_view_column_cell_focus to gtktreeview.c
authorKristian Rietveld <kris@gtk.org>
Sun, 5 Dec 2010 14:18:13 +0000 (15:18 +0100)
committerKristian Rietveld <kris@gtk.org>
Sun, 5 Dec 2010 14:18:13 +0000 (15:18 +0100)
gtk/gtktreeprivate.h
gtk/gtktreeview.c
gtk/gtktreeviewcolumn.c

index 942a2a3f60ac428b26a2980e774044f4c9cb6014..c0dacd55d5a34c9bf482a4b67f391c55756b5ff8 100644 (file)
@@ -139,10 +139,6 @@ void                 _gtk_tree_view_column_get_focus_area   (GtkTreeViewColumn  *tree_column,
                                                          const GdkRectangle *background_area,
                                                          const GdkRectangle *cell_area,
                                                          GdkRectangle       *focus_area);
-gboolean         _gtk_tree_view_column_cell_focus       (GtkTreeViewColumn  *tree_column,
-                                                         gint                count,
-                                                         gboolean            left,
-                                                         gboolean            right);
 void             _gtk_tree_view_column_cell_set_dirty   (GtkTreeViewColumn  *tree_column,
                                                          gboolean            install_handler);
 gboolean          _gtk_tree_view_column_cell_get_dirty   (GtkTreeViewColumn  *tree_column);
index 0a7bf5db383a9a786859170b32afcd667fc52be6..eacfa9b2069e080492b6d44732d2140279245b92 100644 (file)
@@ -10389,6 +10389,59 @@ cleanup:
   gtk_tree_path_free (cursor_path);
 }
 
+static gboolean
+gtk_tree_view_move_focus_column  (GtkTreeView       *tree_view,
+                                  GtkTreeViewColumn *tree_column,
+                                  gint               count,
+                                  gboolean           left,
+                                  gboolean           right)
+{
+  gboolean rtl;
+  GtkDirectionType direction = 0;
+  GtkCellArea *cell_area;
+
+  rtl = gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL;
+
+  switch (count)
+    {
+      case -1:
+        direction = GTK_DIR_LEFT;
+        break;
+
+      case 1:
+        direction = GTK_DIR_RIGHT;
+        break;
+    }
+
+  cell_area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (tree_column));
+
+  /* if we are the current focus column and have multiple editable cells,
+   * try to select the next one, else move the focus to the next column
+   */
+  if (tree_view->priv->focus_column == tree_column)
+    {
+      if (gtk_cell_area_focus (cell_area, direction))
+        /* Focus stays in this column, so we are done */
+        return TRUE;
+
+      /* FIXME: RTL support for the following: */
+      if (count == -1 && !left)
+        {
+          direction = GTK_DIR_RIGHT;
+          gtk_cell_area_focus (cell_area, direction);
+        }
+      else if (count == 1 && !right)
+        {
+          direction = GTK_DIR_LEFT;
+          gtk_cell_area_focus (cell_area, direction);
+        }
+
+      return FALSE;
+    }
+
+  return gtk_cell_area_focus (cell_area, direction);
+}
+
 static void
 gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
                                      gint         count)
@@ -10469,7 +10522,7 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
          right = list->next ? TRUE : FALSE;
 
         }
-      if (_gtk_tree_view_column_cell_focus (column, count, left, right))
+      if (gtk_tree_view_move_focus_column (tree_view, column, count, left, right))
        {
          tree_view->priv->focus_column = column;
          found_column = TRUE;
index 63b10a674ed3b2b6288a2fc5581f10edc7025ab3..f104d1c2db6d65c15e920009d01a41182e714f50 100644 (file)
@@ -2831,56 +2831,6 @@ _gtk_tree_view_column_get_focus_area (GtkTreeViewColumn  *tree_column,
 }
 
 
-gboolean
-_gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
-                                 gint               count,
-                                 gboolean           left,
-                                 gboolean           right)
-{
-  gboolean rtl;
-  GtkDirectionType direction = 0;
-  GtkTreeViewColumnPrivate *priv = tree_column->priv;
-
-  rtl = gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_RTL;
-
-  switch (count)
-    {
-      case -1:
-        direction = GTK_DIR_LEFT;
-        break;
-
-      case 1:
-        direction = GTK_DIR_RIGHT;
-        break;
-    }
-
-  /* if we are the current focus column and have multiple editable cells,
-   * try to select the next one, else move the focus to the next column
-   */
-  if (_gtk_tree_view_get_focus_column (GTK_TREE_VIEW (priv->tree_view)) == tree_column)
-    {
-      if (gtk_cell_area_focus (priv->cell_area, direction))
-        /* Focus stays in this column, so we are done */
-        return TRUE;
-
-      /* FIXME: RTL support for the following: */
-      if (count == -1 && !left)
-        {
-          direction = GTK_DIR_RIGHT;
-          gtk_cell_area_focus (priv->cell_area, direction);
-        }
-      else if (count == 1 && !right)
-        {
-          direction = GTK_DIR_LEFT;
-          gtk_cell_area_focus (priv->cell_area, direction);
-        }
-
-      return FALSE;
-    }
-
-  return gtk_cell_area_focus (priv->cell_area, direction);
-}
-
 /**
  * gtk_tree_view_column_cell_is_visible:
  * @tree_column: A #GtkTreeViewColumn